<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">















 
 
 
 
 
 
 
  
  


<html>
  <head>
    <script type="text/javascript" language="JavaScript">
    ORIGINAL_PAGE_PATH = "/appengine/docs/python/tools/uploadinganapp.html";
    </script>
    
    
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Uploading and Managing a Python App - Google App Engine - Google Code</title>
<script type="text/javascript"><!--
(function(){function a(){this.t={};this.tick=function(c){this.t[c]=(new Date).getTime()};this.tick("start")}var b=new a;window.jstiming={Timer:a,load:b};if(window.external&&window.external.pageT)window.jstiming.pt=window.external.pageT;})();

var _tocPath_ = '/appengine/docs/_toc.ezt';
var codesite_token = null;
//--></script>
<link href="../../../../css/codesite.pack.04102009.css" type="text/css" rel="stylesheet"></link>
<script src="../../../../js/codesite_head.pack.04102009.js" type="text/javascript"></script>
<script type="text/javascript">CODESITE_CSITimer['load'].tick('bhs');</script>
<link rel="search" type="application/opensearchdescription+xml" title="Google Code" href="http://code.google.com/osd.xml" />

<!--[if IE]><link rel="stylesheet" type="text/css" href="../../../../css/iehacks.css" /><![endif]-->

    <link href="../../../../css/semantic_headers.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/local_extensions.css" rel="stylesheet" type="text/css" />
  </head>

  <body class="gc-documentation">

    
    
    
</a>

<div id="gb">
 <span>
  
    <a id="lang-dropdown" class="dropdown" href="http://code.google.com" onclick="return false;"><img class="globeicon" src="../../../../images/globe2_small.png"/><span>English</span></a>
  
 </span>
</div>

<div class="gbh" style="left: 0pt;"></div>
<div class="gbh" style="right: 0pt;"></div>


<style type="text/css">
  #gc-topnav h1 {
    padding: 0 0 0 6px;
  }
</style>


<div id="gc-container">
<a name="top"></a>
<div id="skipto">
  <a href="#gc-pagecontent">Skip to page content</a>
  <a href="#gc-toc">Skip to main navigation</a>
</div>

<div id="gc-header">
  <div id="logo"><a href="http://code.google.com">
  
  
     <img src="../../../../images/cleardot.gif" height="1px" width="1px" alt="Google Code Home Page" id="gc-logo-img"/>
  
  
  </a></div>
  <div id="search">
    <div id="searchForm" class="searchForm">
      <form id="cse" action="http://www.google.com/cse" accept-charset="utf-8" class="gsc-search-box" onsubmit="executeGSearch(document.getElementById('gsearchInput').value); return false;">
      <noscript>
      <input type="hidden" name="cref" value="http://code.google.com/cse/googlecode-context.xml"/>
      </noscript>
        <table class="gsc-search-box" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td class="gsc-input">
                <input id="gsearchInput" type="text" name="q" maxlength="2048" class="gsc-input" autocomplete="off" title="Google Code Search" style="width:345px"/>
              </td>
              <td class="gsc-search-button">
                <div id="cs-searchresults" onclick="event.cancelBubble = true;"></div>
                <input title="Search" id="gsearchButton" class="gsc-search-button" name="sa" value="Search" type="submit"/>
              </td>
            </tr>
            <tr>
              <td colspan="2" class="greytext">e.g. "templates" or "datastore"</td>
            </tr>
          </tbody>
        </table>
      </form>
    </div> <!-- end searchForm -->
  </div> <!-- end search -->
</div> <!-- end gc-header -->


<div id="codesiteContent">

<a name="gc-topnav-anchor"></a>
<div id="gc-topnav">
  <h1>Google App Engine</h1>
  <ul id="docs" class="gc-topnav-tabs">

    <li id="home_link">
      <a href="../../../index.html" title="Google App Engine home page">Home</a>
    </li>
  
    <li id="docs_link">
      <a href="../../index.html" class="selected" title="Official Google App Engine documentation">Docs</a>
    </li>
  
    <li id="faq_link">
      <a href="../../../kb/index.html" title="Answers to frequently asked questions about Google App Engine">FAQ</a>
    </li>
  
    <li id="articles_link">
      <a href="../../../articles/index.html" title="Focused articles and tutorials for Google App Engine developers">Articles</a>
    </li>
  
    <li>
      <a href="http://googleappengine.blogspot.com/" title="Official Google App Engine blog">Blog</a>
    </li>
  
    <li>
      <a href="../../../community.html" title="Community home for Google App Engine">Community</a>
    </li>
  
    <li>
      <a href="../../../terms.html" title="Google App Engine terms of service">Terms</a>
    </li>
  
    <li>
      <a href="../../../downloads.html" title="Download Google App Engine">Download</a>
    </li>
  

  </ul>
</div> <!-- end gc-topnav -->

    <div class="g-section g-tpl-170">

      <div class="g-unit g-first" id="gc-toc">
        <ul>
  <li><a href="../../../downloads.html">Downloads</a></li>
  <li><a href="http://code.google.com/status/appengine">System Status</a></li>
  <li><a href="http://code.google.com/p/googleappengine/issues/list">Issue Tracker</a></li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Getting Started</h2>
    <ul>
      <li><a href="../../whatisgoogleappengine.html">What Is Google App Engine?</a></li>
      <li><a href="../../java/gettingstarted/index.html">Java</a>
        <ul>
              <li><a href="../../java/gettingstarted/introduction.html">Introduction</a></li>
    <li><a href="../../java/gettingstarted/installing.html">Installing the Java SDK</a></li>
    <li><a href="../../java/gettingstarted/creating.html">Creating a Project</a></li>
    <li><a href="../../java/gettingstarted/usingusers.html">Using the Users Service</a></li>
    <li><a href="../../java/gettingstarted/usingjsps.html">Using JSPs</a></li>
    <li><a href="../../java/gettingstarted/usingdatastore.html">Using the Datastore with JDO</a></li>
    <li><a href="../../java/gettingstarted/staticfiles.html">Using Static Files</a></li>
    <li><a href="../../java/gettingstarted/uploading.html">Uploading Your Application</a></li>

        </ul>
      </li>
      <li><a href="../gettingstarted/index.html">Python</a>
        <ul>
            <li><a href="../gettingstarted/introduction.html">Introduction</a></li>
  <li><a href="../gettingstarted/devenvironment.html">The Development Environment</a></li>
  <li><a href="../gettingstarted/helloworld.html">Hello, World!</a></li>
  <li><a href="../gettingstarted/usingwebapp.html">Using the webapp Framework</a></li>
  <li><a href="../gettingstarted/usingusers.html">Using the Users Service</a></li>
  <li><a href="../gettingstarted/handlingforms.html">Handling Forms With webapp</a></li>
  <li><a href="../gettingstarted/usingdatastore.html">Using the Datastore</a></li>
  <li><a href="../gettingstarted/templates.html">Using Templates</a></li>
  <li><a href="../gettingstarted/staticfiles.html">Using Static Files</a></li>
  <li><a href="../gettingstarted/uploading.html">Uploading Your Application</a></li>

        </ul>
      </li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Java <sup class="new">Early Look</sup></h2>
    <ul>
          <li><a href="../../java/overview.html">Overview</a></li>
    <li><a href="../../java/runtime.html">Servlet Environment</a></li>
    <li><a href="../../java/datastore/index.html">Storing Data</a>
      <ul>
            <li><a href="../../java/datastore/overview.html">Overview</a></li>
    <li><a href="../../java/datastore/usingjdo.html">Using JDO</a></li>
    <li><a href="../../java/datastore/dataclasses.html">Defining Data Classes</a></li>
    <li><a href="../../java/datastore/creatinggettinganddeletingdata.html">Creating, Getting and Deleting Data</a></li>
    <li><a href="../../java/datastore/queriesandindexes.html">Queries and Indexes</a></li>
    <li><a href="../../java/datastore/transactions.html">Transactions</a></li>
    <li><a href="../../java/datastore/relationships.html">Relationships</a></li>
    <li><a href="../../java/datastore/usingjpa.html">Using JPA</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/datastore/package-summary.html">Low-level API</a></li>

      </ul>
    </li>
    <li><a href="../../java/apis.html">Services</a>
      <ul>
        <li><a href="../../java/memcache/index.html">Memcache</a>
          <ul>
                <li><a href="../../java/memcache/overview.html">Overview</a></li>
    <li><a href="../../java/memcache/usingjcache.html">Using JCache</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/memcache/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/urlfetch/index.html">URL Fetch</a>
          <ul>
                <li><a href="../../java/urlfetch/overview.html">Overview</a></li>
    <li><a href="../../java/urlfetch/usingjavanet.html">Using java.net</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/urlfetch/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/mail/index.html">Mail</a>
          <ul>
                <li><a href="../../java/mail/overview.html">Overview</a></li>
    <li><a href="../../java/mail/usingjavamail.html">Using JavaMail</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/mail/package-summary.html">Low-level API</a></li>

          </ul>
        </li>
        <li><a href="../../java/images/index.html">Images</a>
          <ul>
                <li><a href="../../java/images/overview.html">Overview</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/images/package-summary.html">API Reference</a></li>

          </ul>
        </li>
        <li><a href="../../java/users/index.html">Google Accounts</a>
          <ul>
                <li><a href="../../java/users/overview.html">Overview</a></li>
    <li><a href="../../java/javadoc/com/google/appengine/api/users/package-summary.html">API Reference</a></li>

          </ul>
        </li>
      </ul>
    </li>
    <li><a href="../../java/javadoc/index.html">Javadoc Reference</a></li>
    <li><a href="../../java/jrewhitelist.html">JRE Class White List</a></li>
    <li><a href="../../java/config/index.html">Configuration</a>
      <ul>
            <li><a href="../../java/config/webxml.html">Deployment Descriptor</a></li>
    <li><a href="../../java/config/appconfig.html">App Config</a></li>
    <li><a href="../../java/config/indexconfig.html">Index Config</a></li>
    <li><a href="../../java/config/cron.html">Scheduled Tasks</a></li>

      </ul>
    </li>
    <li><a href="../../java/tools/index.html">Tools</a>
      <ul>
            <li><a href="../../java/tools/devserver.html">Development Server</a></li>
    <li><a href="../../java/tools/uploadinganapp.html">Uploading and Managing</a></li>
    <li><a href="../../java/tools/eclipse.html">Google Plugin for Eclipse</a></li>
    <li><a href="../../java/tools/ant.html">Using Apache Ant</a></li>

      </ul>
    </li>
    <li><a href="../../java/howto/index.html">How-To</a>
      <ul>
              <li><a href="../../java/howto/unittesting.html">Unit Testing</a></li>

      </ul>
    </li>

    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Python</h2>
    <ul>
          <li><a href="../overview.html">Overview</a></li>
    <li><a href="../runtime.html">CGI Environment</a></li>
    <li><a href="../datastore/index.html">Storing Data</a>
      <ul>
             <li><a href="../datastore/overview.html">Overview</a></li>
     <li><a href="../datastore/entitiesandmodels.html">Entities and Models</a></li>
     <li><a href="../datastore/creatinggettinganddeletingdata.html">Creating, Getting and Deleting Data</a></li>
     <li><a href="../datastore/keysandentitygroups.html">Keys and Entity Groups</a></li>
     <li><a href="../datastore/queriesandindexes.html">Queries and Indexes</a></li>
     <li><a href="../datastore/transactions.html">Transactions</a></li>
     <li><a href="../datastore/typesandpropertyclasses.html">Types and Property Classes</a></li>
     <li><a href="../datastore/gqlreference.html">GQL Reference</a></li>

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../datastore/modelclass.html">Model</a></li>
         <li><a href="../datastore/expandoclass.html">Expando</a></li>
         <li><a href="../datastore/polymodelclass.html">PolyModel</a></li>
         <li><a href="../datastore/propertyclass.html">Property</a></li>
         <li><a href="../datastore/queryclass.html">Query</a></li>
         <li><a href="../datastore/gqlqueryclass.html">GqlQuery</a></li>
         <li><a href="../datastore/keyclass.html">Key</a></li>
         <li><a href="../datastore/functions.html">Functions</a></li>
         <li><a href="../datastore/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

      </ul>
    </li>
    <li><a href="../apis.html">Services</a>
      <ul>
        <li><a href="../memcache/index.html">Memcache</a>
          <ul>
                 <li><a href="../memcache/overview.html">Overview</a></li>
      <li><a href="../memcache/usingmemcache.html">Using Memcache</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../memcache/clientclass.html">Client</a></li>
         <li><a href="../memcache/functions.html">Functions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../urlfetch/index.html">URL Fetch</a>
          <ul>
                 <li><a href="../urlfetch/overview.html">Overview</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../urlfetch/fetchfunction.html">The fetch Function</a></li>
         <li><a href="../urlfetch/responseobjects.html">Response Objects</a></li>
         <li><a href="../urlfetch/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../mail/index.html">Mail</a>
          <ul>
                 <li><a href="../mail/overview.html">Overview</a></li>
     <li><a href="../mail/sendingmail.html">Sending Mail</a></li>
     <li><a href="../mail/attachments.html">Attachments</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../mail/emailmessageclass.html">EmailMessage</a></li>
         <li><a href="../mail/emailmessagefields.html">Message Fields</a></li>
         <li><a href="../mail/functions.html">Functions</a></li>
         <li><a href="../mail/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../images/index.html">Images</a>
          <ul>
                 <li><a href="../images/overview.html">Overview</a></li>
     <li><a href="../images/installingPIL.html">Installing PIL</a></li>
     <li><a href="../images/usingimages.html">Using the Images API</a></li>
     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../images/imageclass.html">Image</a></li>
         <li><a href="../images/functions.html">Functions</a></li>
         <li><a href="../images/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
        <li><a href="../users/index.html">Google Accounts</a>
          <ul>
                 <li><a href="../users/overview.html">Overview</a></li>
     <li><a href="../users/userobjects.html">User Objects</a></li>
     <li><a href="../users/loginurls.html">Login URLs</a></li>
     <li><a href="../users/adminusers.html">Admin Users</a></li>

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="../users/userclass.html">User</a></li>
         <li><a href="../users/functions.html">Functions</a></li>
         <li><a href="../users/exceptions.html">Exceptions</a></li>
       </ul>
     </li>

          </ul>
        </li>
      </ul>
    </li>
    <li><a href="../config/index.html">Configuration</a>
      <ul>
            <li><a href="../config/appconfig.html">App Config</a></li>
    <li><a href="../config/indexconfig.html">Index Config</a></li>
    <li><a href="../config/cron.html">Scheduled Tasks</a></li>

      </ul>
    </li>
    <li><a href="index.html">Tools</a>
      <ul>
            <li><a href="devserver.html">Development Server</a></li>
    <li><a href="uploadinganapp.html">Uploading and Managing</a></li>
    <li><a href="uploadingdata.html">Uploading Data</a></li>
    <li><a href="webapp/index.html">webapp Framework</a>
      <ul>
             <li><a href="webapp/overview.html">Overview</a></li>
     <li><a href="webapp/running.html">Running the Application</a></li>
     <li><a href="webapp/requesthandlers.html">Request Handlers</a></li>
     <li><a href="webapp/requestdata.html">Request Data</a></li>
     <li><a href="webapp/buildingtheresponse.html">Building the Response</a></li>
     <li><a href="webapp/redirects.html">Redirects, Headers and Status Codes</a></li>
     

     <li><span class="tlw-title tlw-expanded">Reference</span>
       <ul>
         <li><a href="webapp/requestclass.html">Request</a></li>
         <li><a href="webapp/responseclass.html">Response</a></li>
         <li><a href="webapp/requesthandlerclass.html">RequestHandler</a></li>
         <li><a href="webapp/wsgiapplicationclass.html">WSGIApplication</a></li>
         <li><a href="webapp/utilmodule.html">Utility Functions</a></li>
         
       </ul>
     </li>

      </ul>
    </li>
    <li><a href="libraries.html">Third-party Libraries</a></li>

      </ul>
    </li>
    <li><a href="../howto/index.html">How-To</a>
      <ul>
              <li><a href="../howto/usinggdataservices.html">Google Data Services</a></li>

      </ul>
    </li>

    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Managing Your App</h2>
    <ul>
      <li><a href="../../theadminconsole.html">The Admin Console</a></li>
      <li><a href="../../quotas.html">Quotas</a></li>
      <li><a href="../../billing.html">Billing</a></li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><h2>Resources</h2>
    <ul>
      <li><a href="../../../kb/index.html">FAQ</a></li>
      <li><a href="../../../articles/index.html">Articles</a></li>
      <li><a href="http://appengine-cookbook.appspot.com/">Cookbook</a></li>
      <li><a href="http://appgallery.appspot.com/">App Gallery</a></li>
      <li><a href="http://code.google.com/p/googleappengine/">SDK Code</a></li>
      <li><a href="http://code.google.com/p/google-app-engine-samples/">Sample Apps Code</a></li>
      <li><a href="../../../community.html">Discussion Groups</a></li>
    </ul>
  </li>
</ul>
<div class="line"></div>
<ul>
  <li><a href="../../roadmap.html">Product Roadmap</a></li>
  <li><a href="http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes">Release Notes</a></li>
  <li><a href="../../revision_history.html">Revision History</a></li>
</ul>

        <a class="hidden" href="#gc-topnav-anchor">More Google App Engine resource links</a>
      </div>

      <div class="g-unit" id="gc-pagecontent">
        <h1 class="page_title">Uploading and Managing a Python App</h1>



<p>The App Engine Python SDK includes a command for interacting with App Engine named <code>appcfg.py</code>.  You can use this command to upload new versions of the code, configuration and static files for your app to App Engine.  You can also use the command to manage datastore indexes and download log data.</p>

<ul>
  <li><a href="#Uploading_the_App">Uploading the App</a></li>
  <li><a href="#Updating_Indexes">Updating Indexes</a></li>
  <li><a href="#Deleting_Unused_Indexes">Deleting Unused Indexes</a></li>
  <li><a href="#Managing_Scheduled_Tasks">Managing Scheduled Tasks</a></li>
  <li><a href="#Downloading_Logs">Downloading Logs</a></li>
  <li><a href="#Uploading_Data">Uploading Data</a></li>
  <li><a href="#Using_an_HTTP_Proxy">Using an HTTP Proxy</a></li>
  <li><a href="#Command_Line_Arguments">Command-Line Arguments</a></li>
</ul>


<h2 id="Uploading_the_App">Uploading the App</h2>

<p>To upload application files, run the <code>appcfg.py</code> command with the <code>update</code> action and the name of your application's root directory.  The root directory should contain the <a href="../config/appconfig.html">app.yaml</a> file for the application.</p>

<pre>
appcfg.py update myapp/
</pre>

<p><code>appcfg.py</code> gets the application ID from the <code>app.yaml</code> file, and prompts you for the email address and password of your Google account.  After successfully signing in with your account, <code>appcfg.py</code> stores a "cookie" so that it does not need to prompt for a password on subsequent attempts.</p>

<p>You can specify the email address on the command line using the <code>--email</code> option.  You cannot specify the password as a command line option.</p>

<pre>
appcfg.py --email=Albert.Johnson@example.com update myapp/
</pre>


<h2 id="Updating_Indexes">Updating Indexes</h2>

<p>When you upload an application using <code>appcfg.py update</code>, the update includes the app's <code>index.yaml</code> file.  If the <code>index.yaml</code> file defines an index that doesn't exist yet on App Engine, App Engine creates the new index.  Depending on how much data is already in the datastore that needs to be mentioned in the new index, the process of creating the index may take a while.  If the app performs a query that requires an index that hasn't finished building yet, the query will raise an exception.</p>

<p>To prevent this, you must ensure that the new version of the app that requires a new index is not the live version of the application until the indexes finish building.  One way to do this is to give the app a new version number in <code>app.yaml</code> whenever you add or change an index in <code>index.yaml</code>.  The app is uploaded as a new version, and does not become the default version automatically.  When your indexes have finished building, you change the default version to the new one using the "Versions" section of the <a href="../../theadminconsole.html">Admin Console</a>.</p>

<p>Another way to ensure that new indexes are built before the new app goes live is to upload the <code>index.yaml</code> configuration separately before uploading the app.  To upload only the index configuration for an app, use the following command:</p>

<pre>
appcfg.py update_indexes myapp/
</pre>

<p>You can check the status of the app's indexes from the "Indexes" section of <a href="../../theadminconsole.html">the Admin Console</a>.


<h2 id="Deleting_Unused_Indexes">Deleting Unused Indexes</h2>

<p>When you change or remove an index from <code>index.yaml</code>, the original index is <i>not</i> deleted from App Engine automatically.  This gives you the opportunity to leave an older version of the app running while new indexes are being built, or to revert to the older version immediately if a problem is discovered with a newer version.</p>

<p>When you are sure that old indexes are no longer needed, you can delete them from App Engine using the following command:</p>

<pre>
appcfg.py vacuum_indexes myapp/
</pre>

<p>This command deletes all indexes for the app that are not mentioned in the most recently uploaded version of <code>index.yaml</code>.</p>

<h2 id="Managing_Scheduled_Tasks">Managing Scheduled Tasks</h2>

<p>App Engine supports scheduled tasks (known as cron jobs). You specify these in a file called <code>cron.yaml</code>, and upload them using the <code>appcfg.py update_cron</code> command:</p> 

<pre>
appcfg.py update_cron myapp/
</pre>

<p><code>appcfg update</code> will also upload cron job specifications if the file exists. For more on cron jobs, see the <a href="../config/cron.html">Cron Jobs</a> documentation.</p>

<h2 id="Downloading_Logs">Downloading Logs</h2>

<p>App Engine maintains a log of messages that your application emits using the <code>logging</code> module from the Python standard library, as well as other messages printed to the standard error stream.  App Engine also records each request in the log.  You can browse your app's logs from the "Logs" section of <a href="../../theadminconsole.html">the Admin Console</a>.</p>

<p>If you wish to perform more detailed analysis of your application's logs, you can download the log data to a file on your computer.  To download logs to a file named <code>mylogs.txt</code>, use the following command:</p>

<pre>
appcfg.py request_logs myapp/ mylogs.txt
</pre>

<p>By default, the command downloads log messages from the current calendar day (since midnight Pacific Time) with a log level of INFO or higher (omitting DEBUG level messages).  The command overwrites the local log file.  You can adjust the number of days, the minimum log level, and whether to overwrite or append to the local log file using command-line options.  See below for more information on these options.</p>

<p>You can limit the log messages that are downloaded to just those emitted during request on a given domain name using the <code>--vhost=...</code> option.  You can use this to download the logs for your live app using a Google Apps domain or <code>app-id.appspot.com</code>, excluding log messages emitted by versions you are testing on URLs such as <code>2.latest.app-id.appspot.com</code>.  Or you can use it to download just the log messages for a given test domain.</p>


<h2 id="Uploading_Data">Uploading Data</h2>

<p>You can upload large amounts data to your application's data store using <code>appcfg.py</code> with the <code>upload_data</code> action.  This action requires that you set up a special request handler in your Python application.  For complete instructions on how to use this feature, see <a href="uploadingdata.html">Uploading Data</a>.</p>


<h2 id="Using_an_HTTP_Proxy">Using an HTTP Proxy</h2>

<p>If you are running <code>appcfg.py</code> behind an HTTP proxy, you must tell <code>appcfg.py</code> the name of the proxy.  To set an HTTP proxy for <code>appcfg.py</code>, set the <code>http_proxy</code> environment variable.</p>

<p>Using Windows (in Command Prompt):</p>

<pre>
set HTTP_PROXY=http://cache.mycompany.com:3128
appcfg.py update myapp
</pre>

<p>Using the command line in Mac OS X (in Terminal) or Linux:</p>

<pre>
export http_proxy="http://cache.mycompany.com:3128"
appcfg.py update myapp
</pre>


<h2 id="Command_Line_Arguments">Command-Line Arguments</h2>

<p>The <code>appcfg.py</code> command takes a set of options, an action, and arguments for the action.</p>

<p>The following actions are available:</p>

<dl>
  <dt><code>appcfg.py <i>[options]</i> update <i>&lt;app-directory&gt;</i></code></dt>
  <dd>
    <p>Uploads files for an application given the application's root directory.  The application ID and version are taken from the <code>app.yaml</code> file in the app directory.</p>
  </dd>

  <dt><code>appcfg.py <i>[options]</i> rollback <i>&lt;app-directory&gt;</i></code></dt>
  <dd>
    <p>Undo a partially completed update for the given application.  You can use this if an update was interrupted, and the command is reporting that the application cannot be updated due to a lock.</p>
  </dd>

  <dt><code>appcfg.py <i>[options]</i> update_indexes <i>&lt;app-directory&gt;</i></code></dt>
  <dd>
    <p>Updates datastore indexes in App Engine to include newly added indexes.  If a new version of your application requires an additional index definition that was added to <a href="../config/indexconfig.html">index.yaml</a>, you can update your index definitions in App Engine prior to uploading the new version of your application.  Running this action a few hours prior to uploading your new application version will give the indexes time to build and be serving when the application is deployed.</p>
  </dd>

  <dt><code>appcfg.py <i>[options]</i> vacuum_indexes <i>&lt;app-directory&gt;</i></code></dt>
  <dd>
    <p>Delete unused datastore indexes in App Engine.  If an index definition is removed from <a href="../config/indexconfig.html">index.yaml</a>, the index is not deleted automatically when the application is uploaded because it may be in use by another version of the application.  Run this action when all old indexes are no longer needed.</p>
  </dd>

  <dt><code>appcfg.py <i>[options]</i> request_logs <i>&lt;app-directory&gt;</i> <i>&lt;output-file&gt;</i></code></dt>
  <dd>
    <p>Retrieve log data for the application running on App Engine.  <code><i>output-file</i></code> is the name of the file to create, replace or append (if the <code>--append</code> flag is set).  If <code><i>output-file</i></code> is a hyphen (<code>-</code>), the log data is printed to the console.  The following options apply to <code>request_logs</code>:</p>
    <dl>
      <dt><code>--num_days=<i>...</i></code></dt>
      <dd>
        <p>The number of days of log data to retrieve, ending on the current date at midnight UTC.  A value of 0 retrieves all available logs.  If <code>--append</code> is given, then the default is 0, otherwise the default is 1.</p>
      </dd>
      <dt><code>--severity=<i>...</i></code></dt>
      <dd>
        <p>The minimum log level for the log messages to retrieve.  The value is a number corresponding to the log level: 4 for CRITICAL, 3 for ERROR, 2 for WARNING, 1 for INFO, 0 for DEBUG.  All messages at the given log level and above will be retrieved.  Default is 1 (INFO).</p>
      </dd>
      <dt><code>--append</code></dt>
      <dd>
        <p>Append the fetched data to the output file, starting with the first log line not already present in the file.  Running this command once a day with <code>--append</code> results in a file containing all log data.</p>
        <p>The default is to overwrite the output file.  Does not apply if <code><i>output-file</i></code> is <code>-</code> (printing to the console).</p>
      </dd>
      <dt><code>--vhost=<i>...</i></code></dt>
      <dd>
        <p>If present, limits the log messages downloaded to just those emitted by requests for a given domain name.  For instance, <code>--vhost=example.com</code> will download just the log messages for the live app at the Google Apps domain <code>example.com</code>, excluding any log messages emitted by a new version being tested at <code>2.latest.myapp.appspot.com</code>.  Similarly, <code>--vhost=2.latest.myapp.appspot.com</code> downloads just the logs for the test version, excluding the live version.</p>
        <p>The value is a regular expression that matches the <code>Host</code> header of the incoming requests.  Note that the pattern is case sensitive, even though domain names usually are not.</p>
      </dd>
    </dl>
  </dd>

  <dt><code>appcfg.py <i>[options]</i> upload_data <i>&lt;app-directory&gt;</i></code></dt>
  <dd>
    <p>Upload data to the datastore from CSV files.  For complete information on using this feature, see <a href="uploadingdata.html">Uploading Data</a>.</p>
  </dd>

  <dt><code>appcfg.py help <i>&lt;action&gt;</i></code></dt>
  <dd>
    <p>Print a help message about the given action, then quit.</p>
  </dd>
</dl>

<p>The <code>appcfg.py</code> command accepts the following options for all actions:</p>

<dl>
  <dt><code>--quiet</code></dt>
  <dd>
    <p>Do not print messages when successful.</p>
  </dd>

  <dt><code>--verbose</code></dt>
  <dd>
    <p>Print messages about what the command is doing.</p>
  </dd>

  <dt><code>--noisy</code></dt>
  <dd>
    <p>Print many messages about what the command is doing.  This is mostly useful when working with the App Engine team to troubleshoot an upload issue.</p>
  </dd>

  <dt><code>--email=<i>...</i></code></dt>
  <dd>
    <p>The email address of the Google account of an administrator for the application, for actions that require signing in.  If omitted and no cookie is stored from a previous use of the command, the command will prompt for this value.</p>
  </dd>

  <dt><code>--passin</code></dt>
  <dd>
    <p>If given, the tool accepts the Google account password in stdin instead of prompting for it interactively.  This allows you to invoke the tool from a script without putting your password on the command line.</p>
  </dd>

  <dt><code>--server=<i>...</i></code></dt>
  <dd>
    <p>The App Engine server hostname.  The default is <code>appengine.google.com</code>.</p>
  </dd>

  <dt><code>--host=<i>...</i></code></dt>
  <dd>
    <p>The hostname of the local machine for use with remote procedure calls.</p>
  </dd>

  <dt><code>--no_cookies</code></dt>
  <dd>
    <p>Do not store the administrator sign-in credentials as a cookie; prompt for a password every time.</p>
  </dd>

  <dt><code>--force</code></dt>
  <dd>
    <p>Force deletion of unused indexes.  By default, uploading an app does not delete unused indexes from the server, even if they do not appear in the <code>index.yaml</code> file.</p>
  </dd>

  <dt><code>--max_size=...</code></dt>
  <dd>
    <p>A maximum size of files to upload, as a number of bytes.  Files larger than this size will not be uploaded.  The default is <code>1048576</code>.  The server currently enforces a maximum file size of 1,048,576 bytes, so increasing this value will not have any effect.</p>
  </dd>

</dl>



      </div><!-- end gc-pagecontent -->
   </div><!-- end gooey wrapper -->

    </div> <!-- end codesite content -->

<div id="gc-footer" dir="ltr">
  <div class="text">
    
      <div class="notice"><div id="notice" style="text-align: center; border: 1em 0em 1em 0em">
  Except as otherwise <a
  href="http://code.google.com/policies.html#restrictions">noted</a>,
  the content of this page is licensed under the <a rel="license"
  href="http://creativecommons.org/licenses/by/2.5/">Creative Commons
  Attribution 2.5 License</a>, and code samples are licensed under the
  <a rel="license" href="http://www.apache.org/licenses/LICENSE-2.0">Apache
  2.0 License</a>.
<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" 
              xmlns:dc="http://purl.org/dc/elements/1.1/"
              xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <Work rdf:about="">
    <license rdf:resource="http://creativecommons.org/licenses/by/2.5/" />
  </Work>
  <License rdf:about="http://creativecommons.org/licenses/by/2.5/">
    <permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
    <permits rdf:resource="http://web.resource.org/cc/Distribution"/>
    <requires rdf:resource="http://web.resource.org/cc/Notice"/>
    <requires rdf:resource="http://web.resource.org/cc/Attribution"/>
    <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
  </License>
</rdf:RDF> -->
</div>
Java is a registered trademark of Sun Microsystems, Inc.</div>
    
    &copy;2009 Google -
    <a href="http://code.google.com">Code Home</a> -
    <a href="http://www.google.com/accounts/TOS">Terms of Service</a> -
    <a href="http://www.google.com/privacy.html">Privacy Policy</a> -
    <a href="http://code.google.com/more">Site Directory</a>
    <br /> <br />
    Google Code offered in:
    <a href="http://code.google.com/intl/en">English</a> -
    <a href="http://code.google.com/intl/es">Español</a> -
    <a href="http://code.google.com/intl/ja">日本語</a> -
    <a href="http://code.google.com/intl/ko">한국어</a> -
    <a href="http://code.google.com/intl/pt-BR">Português</a> -
    <a href="http://code.google.com/intl/ru">Pусский</a> -
    <a href="http://code.google.com/intl/zh-CN">中文(简体)</a> -
    <a href="http://code.google.com/intl/zh-TW">中文(繁體)</a>
  </div>
</div><!-- end gc-footer -->

</div><!-- end gc-containter -->

<script type="text/javascript">CODESITE_CSITimer['load'].tick('ats');</script>
<script src="../../../../js/codesite_tail.pack.04102009.js" type="text/javascript"></script>






  </body>
</html>


